home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 4,401 to 4,500 / aol-file-protocol-4400-4401-to-4500.zip / AOLDLs / PDA-Newton Development / ND Register Sample Code / RegisterSampleCode.sit / RegisterSampleCode ƒ / RegTest π.text < prev   
Text File  |  1994-11-26  |  6KB  |  216 lines

  1. constant kAppSymbol := '|RegTest:FlaSheridn| ;
  2. constant kSharewareFee := 42;
  3. //constant kSharewareFeeString := "$42";  //optional
  4. constant kVersionString := "1.0d1";
  5.  
  6.  
  7. write("\n" & "_______________________________________" & "\n" 
  8.     & kAppSymbol  && kVersionString &&
  9.     dateNTime(Time()) & 
  10.     "\n" & "_______________________________________" & "\n" & "\n"); 
  11.  
  12.  
  13. defconst( 'kReverseStringsFunc,
  14. func(a,b,c) 
  15. begin
  16.     local inp := a && b && c    ;
  17.     local out := "";
  18.     for i := 0 to strLen(inp) -1 
  19.         do out := inp[i] & out;
  20.     return out;
  21. end;
  22.                     );
  23.  
  24.  
  25. // ---- End Project Data ----
  26.  
  27.  
  28. // ---- File RegTest Layout ----
  29. RegTest :=
  30.    {title: "RegTest",
  31.     viewBounds: {left: -8, top: 34, right: 148, bottom: 214},
  32.     viewFormat: 83951953,
  33.     ShareWareFee: kSharewareFee,
  34.     VersionString: kVersionString,
  35.     IPaid:
  36.       func(frame)
  37.       begin
  38.           local regProg := sprintObject(frame.registrationProgram);  
  39.               //Who the calling program _says_ it is; but it might be lying.
  40.           local amountText := frame.amountText;  //may start with "<"
  41.           local amount :=  floor(stringToNumber(
  42.               Stringfilter(amountText, "0123456789,.", 'passAll)
  43.               ));
  44.           local reliability := frame.reliability;      
  45.               //Don't necessarily trust this number; see below.
  46.           Print ("Registered by" && regProg && "for" && "$" & amount) ;
  47.           local thanksMess :=
  48.               if amount < kSharewareFee then "Cheapskate"
  49.                   else if amount > kSharewareFee then "Spendthrift"
  50.                       else "New customer";
  51.           GetRoot():Notify(kNotifyQAlert, 
  52.                ensureInternal(sprintObject(kAppSymbol)), 
  53.                ensureInternal(thanksMess) );
  54.       end
  55.       
  56.       
  57.       /*
  58.       Note that the Ipaid method╒s reliability slot is the *calling* program's 
  59.       estimate, which may be wrong or even dishonest. I don't recommend 
  60.       relying exclusively on this method for verification of payment.  The 
  61.       current version of Register gives a reliability value of 1 (on a scale of 10); 
  62.       this means that the user entered a number which bore a superficial 
  63.       resemblance to a credit card number, and pressed the Action button.  
  64.       It doesn't even indicate that the user put a mail message or a fax in his 
  65.       Out Box.  (That would be a 2, and would require some hacking on my part.), 
  66.       much less that he actually mailed it and the order was received and 
  67.       approved.   
  68.       */,
  69.     _proto: protoApp,
  70.     debug: "RegTest"
  71.    };
  72.  
  73.  
  74. // ---- File MoneyButtonProto ----
  75. _userproto000 :=
  76.    {
  77.     buttonClickScript:
  78.       func()
  79.       Begin
  80.       local RegView := GetRoot().(RegistrationPackage);
  81.       
  82.       if not RegView then 
  83.       begin
  84.           GetRoot():Notify(kNotifyQAlert, 
  85.                ensureInternal("Shareware Registration"), 
  86.                ensureInternal("I can╒t find" && sprintObject(RegistrationPackage) ) );
  87.       end
  88.       else
  89.       begin
  90.           RegView:?open();
  91.           RegView:?ExternalRegister(RegFrame);
  92.       end;
  93.       
  94.       
  95.       End,
  96.     viewBounds: {top: -16, left: -63, right: -48, bottom: -3},
  97.     viewJustify: 8388778,
  98.     RegFrame:
  99.       {package: kAppSymbol, 
  100.       price: kSharewareFee,
  101.       platform: 'Newton, 
  102.       
  103.       
  104.       
  105.       //Version: kVersionString,
  106.                   //version is optional
  107.       
  108.           // Stuff below need only exist if the user is _not_ registering 
  109.           // via the Kagi Shareware Clearinghouse.
  110.       
  111.       // newRegistrationCompanies:
  112.       //    [
  113.       //        {    Company: setclass("Yoyodyne Bank of Commerce", 'Company) ,
  114.       //            Email: "John@home.org",
  115.       //            Phones: [ setclass("911", 'faxPhone) ]    }
  116.       //        }
  117.       //    ]
  118.       
  119.       
  120.       },
  121.     RegistrationPackage: '|Register:FlaSheridn|,
  122.     icon: GetPictAsBits("RegisterMoneyButton", nil),
  123.     _proto: protoPictureButton
  124.    };
  125.  
  126.  
  127. // ---- Back in File RegTest Layout ----
  128. _view000 := /* child of RegTest */ {_proto: _userproto000};
  129.  
  130.  
  131.  
  132. _view001 := /* child of RegTest */
  133.    {viewJustify: 166,
  134.     viewBounds: {top: -16, left: -42, right: -25, bottom: -3},
  135.     buttonClickScript:
  136.       func()
  137.       begin
  138.               GetRoot():Notify(kNotifyQAlert, 
  139.                ensureInternal(sprintObject(kAppSymbol)), 
  140.                ensureInternal("This is only a test for the protoMoneyButton.  FlaSheridn@rahul.net" ) );
  141.       
  142.           //inherited:?buttonClickScript();        // this method is defined internally
  143.           nil
  144.       end,
  145.     _proto: protoActionButton
  146.    };
  147.  
  148.  
  149.  
  150. weirdMoneyButton := /* child of RegTest */
  151.    {viewBounds: {top: -98, left: -84, right: -69, bottom: -85},
  152.     RegFrame:
  153.       {
  154.       package: '|PocketLucre:BCCI|, 
  155.       Version: "1.02",
  156.       platform: 'Newton, 
  157.       price: 2,
  158.       notes: "This is a rumor.  This is only a rumor.",
  159.        newRegistrationCompanies:
  160.        [
  161.           {    Company: setclass("Bank of Commerce Etc.", 'Company) ,
  162.               Email: "Cliff@bcci.com",
  163.               Phones: [ setclass("408-524-9524", 'faxPhone) ]    
  164.           }
  165.        ]
  166.        
  167.       },
  168.     _proto: _userproto000,
  169.     debug: "weirdMoneyButton"
  170.    };
  171.  
  172.  
  173.  
  174. ReallyStrangeButton := /* child of RegTest */
  175.    {viewBounds: {top: -66, left: -132, right: -117, bottom: -53},
  176.     RegFrame:
  177.       {package: '|CerealTool:OCP|, 
  178.       price: 495, 
  179.       platform: '|OS/2|, 
  180.       
  181.       
  182.       
  183.       Version: -42,
  184.       notes: "In the name of justice and a strong economy, Commander Cash says, \"Send in your shareware payments!\"",
  185.       
  186.           // Stuff below need only exist if the user is _not_ registering 
  187.           // via the Kagi Shareware Clearinghouse.
  188.       
  189.       EncodingType: "reverse",
  190.       EncodingFunction: kReverseStringsFunc,
  191.       
  192.       
  193.        newRegistrationCompanies:
  194.           [
  195.               {    Company: setclass("Mediplex", 'Company) ,
  196.                   Email: "chairman@ocp.com",
  197.                   Phones: [ setclass("900-544-8444", 'faxPhone) ]    
  198.               }
  199.           ]
  200.       
  201.       
  202.       },
  203.     _proto: _userproto000,
  204.     debug: "ReallyStrangeButton"
  205.    };
  206. // View ReallyStrangeButton is declared to RegTest
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214. // ---- Beginning of section for non used Layout files ----
  215.  
  216. // End of output